<extend name="./public/frame.html"/>
<block name="content">
    <form class="layui-form" action="" method="post">
        <div class="layui-collapse" lay-filter="driver">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title" data-v="driver">个人基本信息</h2>
                <div class="layui-colla-content layui-show">
                    <table class="layui-table">

                        <tr>
                            <td>姓名</td>
                            <td>
                                <input type="text" name="driver_name" required="required" value="{$driverCar['driver_name']}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>

                        <tr>
                            <td>联系方式</td>
                            <td>
                                <input type="text" name="driver_phone" required="required" value="{$driverCar[driver_phone]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>

                        <tr>
                            <td>身份证号码</td>
                            <td>
                                <input type="text" name="id_number" required="required" value="{$driverCar[id_number]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>
                        <?php if($theirId){ ?>
                        <input type="hidden" name="their_id" value="{$theirId}">
                        <?php }else{ ?>
                        <tr>
                            <td>车辆所属公司</td>
                            <td>
                                <select name="their_id" id="their_id" class="layui-input" lay-filter="province" style="width: 120px;display: block;float: left">-->
                                    <option value="">请选择</option>
                                    <?php foreach($theirList as $key=>$value):?>
                                    <option value="<?php echo $value['their_id'];?>" <?php if($value['their_id']==$driverCar[their_id]){echo 'selected';} ?>><?php echo $value['their_name'];?></option>
                                    <?php endforeach;?>
                                </select>
                            </td>
                        </tr>
                        <?php } ?>


                        <tr>
                            <td>驾驶证注册时间</td>
                            <td>
                                <input type="text" name="license_time" required="required" id="license_time" value="{$driverCar[license_time]}" lay-verify="required" placeholder="驾驶证注册时间" class="layui-input" style="width: 150px;float: left;margin-right: 10px;">
                            </td>
                        </tr>

                        <tr>
                            <td>驾驶证有效时间</td>
                            <td>
                                <input type="text" name="valid_time" required="required" value="{$driverCar[valid_time]}" id="valid_time" lay-verify="required" placeholder="驾驶证有效时间" class="layui-input" style="width: 150px;float: left;margin-right: 10px;">
                            </td>
                        </tr>

                        <tr>
                            <td>身份证正面</td>
                            <td class="layer-photos-demo">
                                <input type="hidden" value="{$driverCar[id_front]}" required="required" name="id_front" id="image_10">
                                <input type="hidden" value="{$driverCar[id_front_thumb]}" required="required" name="id_front_thumb" id="image_thumb_10">

                                <a href="" target="_blank" id="img_1"><img  id="image_1" layer-src="{$driverCar[id_front_thumb]}" src="{$driverCar[id_front_thumb]}" width="100px;" height="100px;"></a>
                                <button type="button" class="layui-btn uploads" id="upload-1">上传图片</button>
                            </td>
                        </tr>

                        <tr>
                            <td>身份证反面</td>
                            <td class="layer-photos-demo">
                                <input type="hidden" value="{$driverCar['id_back']}" required="required" name="id_back" id="image_20">
                                <input type="hidden" value="{$driverCar['id_back_thumb']}" required="required" name="id_back_thumb" id="image_thumb_20">
                                <a href="" target="_blank" id="img_2"><img  id="image_2" layer-src="{$driverCar['id_back_thumb']}" src="{$driverCar['id_back_thumb']}" width="100px;" height="100px;"></a>
                                <button type="button" class="layui-btn uploads" id="upload-2">上传图片</button>
                            </td>
                        </tr>

                        <tr>
                            <td>手持身份证图</td>
                            <td class="layer-photos-demo">
                                <!--id_hold-->
                                <input type="hidden" value="{$driverCar[id_hold]}" required="required" name="id_hold" id="image_30">
                                <input type="hidden" value="{$driverCar[id_hold_thumb]}" required="required" name="id_hold_thumb" id="image_thumb_30">
                                <a href="" target="_blank" id="img_3"><img  id="image_3" layer-src="{$driverCar[id_hold_thumb]}" src="{$driverCar[id_hold_thumb]}" width="100px;" height="100px;"></a>
                                <button type="button" class="layui-btn uploads" id="upload-3">上传图片</button>
                            </td>
                        </tr>

                    </table>
                </div>
            </div>
            <div class="layui-colla-item">
                <h2 class="layui-colla-title"  data-v="car">车辆基本信息</h2>
                <div class="layui-colla-content layui-show">
                    <table class="layui-table">

                        <tr>
                            <td>座位数</td>
                            <td>
                                <input type="text" name="seats" required="required" value="{$driverCar[seats]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>

                        <tr>
                            <td>车辆识别码</td>
                            <td>
                                <input type="text" name="car_vin" required="required" value="{$driverCar[car_vin]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>

                        <tr>
                            <td>发动机车架号</td>
                            <td>
                                <input type="text" name="vin" required="required" value="{$driverCar[vin]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>

                        <tr>
                            <td>车牌</td>
                            <td>
                                <input type="text" name="car_plate" required="required" value="{$driverCar[car_plate]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>

                        <tr>
                            <td>车辆品牌</td>
                            <td>
                                <input type="text" name="car_brand" required="required" value="{$driverCar[car_brand]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>

                        <tr>
                            <td>车辆型号</td>
                            <td>
                                <input type="text" name="car_model" required="required" value="{$driverCar[car_model]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>

                        <tr>
                            <td>颜色</td>
                            <td>
                                <input type="text" name="color" required="required" value="{$driverCar[color]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>
                        <tr>
                            <td>车辆所有人</td>
                            <td>
                                <input type="text" name="owner" required="required" value="{$driverCar[owner]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>
                        <tr>
                            <td>车辆注册时间</td>
                            <td>
                                <input type="text" name="register_at" required="required" id="register_at" value="<?php echo date('Y-m-d',$driverCar[register_at]);?>" lay-verify="required" placeholder="车辆注册时间" class="layui-input date" readonly style="width: 150px;float: left;margin-right: 10px;">
                            </td>
                        </tr>

                        <tr>
                            <td>营运证件号码</td>
                            <td>
                                <input type="text" name="taxi_license_number" required="required" value="{$driverCar[taxi_license_number]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>
                        <tr>
                            <td>驾驶证号码</td>
                            <td>
                                <input type="text" name="license_number" required="required" value="{$driverCar[license_number]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>

                        <tr>
                            <td>车架号</td>
                            <td>
                                <input type="text" name="frame_number" required="required" value="{$driverCar[frame_number]}" class="layui-input abc" style="width:150px;display: inline;margin-right: 15px">
                            </td>
                        </tr>

                        <tr>
                            <td>驾驶证</td>
                            <td class="layer-photos-demo">
                                <input type="hidden" value="{$driverCar[license]}" required="required" name="license" id="image_40">
                                <input type="hidden" value="{$driverCar[license_thumb]}" required="required" name="license_thumb" id="image_thumb_40">
                                <a href="" target="_blank" id="img_4"><img  id="image_4" layer-src="{$driverCar[license_thumb]}" src="{$driverCar[license_thumb]}" width="100px;" height="100px;"></a>
                                <button type="button" class="layui-btn uploads" id="upload-4">上传图片</button>
                            </td>
                        </tr>

                        <tr>
                            <td>行驶证</td>
                            <td class="layer-photos-demo">
                                <input type="hidden" value="{$driverCar[permit]}" required="required" name="permit" id="image_50">
                                <input type="hidden" value="{$driverCar[permit_thumb]}" required="required" name="permit_thumb" id="image_thumb_50">
                                <a href="" target="_blank" id="img_5"><img  id="image_5" layer-src="{$driverCar[permit_thumb]}" src="{$driverCar[permit_thumb]}" width="100px;" height="100px;"></a>
                                <button type="button" class="layui-btn uploads" id="upload-5">上传图片</button>
                            </td>
                        </tr>

                        <tr>
                            <td>车辆运输证</td>
                            <td class="layer-photos-demo">
                                <input type="hidden" value="{$driverCar[taxi]}" required="required" name="taxi" id="image_60">
                                <input type="hidden" value="{$driverCar[taxi_thumb]}" required="required" name="taxi_thumb" id="image_thumb_60">
                                <a href="" target="_blank" id="img_6"><img  id="image_6" layer-src="{$driverCar[taxi_thumb]}" src="{$driverCar[taxi_thumb]}" width="100px;" height="100px;"></a>
                                <button type="button" class="layui-btn uploads" id="upload-6">上传图片</button>
                            </td>
                        </tr>

                        <tr>
                            <td>服务资格证</td>
                            <td class="layer-photos-demo">
                                <input type="hidden" value="{$driverCar[service]}" required="required" name="service" id="image_70">
                                <input type="hidden" value="{$driverCar[service_thumb]}" required="required" name="service_thumb" id="image_thumb_70">
                                <a href="" target="_blank" id="img_7"><img  id="image_7" layer-src="{$driverCar[service_thumb]}" src="{$driverCar[service_thumb]}" width="100px;" height="100px;"></a>
                                <button type="button" class="layui-btn uploads" id="upload-7">上传图片</button>
                            </td>
                        </tr>

                        <tr>
                            <td>车身图</td>
                            <td class="layer-photos-demo">
                                <input type="hidden" value="{$driverCar[body_img]}" required="required" name="body_img" id="image_80">
                                <input type="hidden" value="{$driverCar[body_img_thumb]}" required="required" name="body_img_thumb" id="image_thumb_80">
                                <a href="" target="_blank" id="img_8"><img  id="image_8" layer-src="{$driverCar[body_img_thumb]}" src="{$driverCar[body_img_thumb]}" width="100px;" height="100px;"></a>
                                <button type="button" class="layui-btn uploads" id="upload-8">上传图片</button>
                            </td>
                        </tr>

                    </table>
                </div>
            </div>

        </div>
        <p style="padding: 10px;color: red">所有信息/图片必须填写上传</p>
        <input type="hidden" value="3" name="auth_type">
        <input type="hidden" value="{$driverCar[driver_id]}" name="driver_id">
        <button class="layui-btn" onclick="" lay-submit="submit" lay-filter="submit">提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </form>
    <script>
        layui.use(['layer','upload','element','laydate'], function(){
            var layer = layui.layer;
            var element = layui.element;
            var upload = layui.upload;
            form = layui.form;
            var laydate = layui.laydate;
            laydate.render({
                elem: '#license_time'
            });
            laydate.render({
                elem: '#valid_time'
            });
            laydate.render({
                elem: '#register_at'
            });
            layer.photos({
                photos: '.layer-photos-demo'
                ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
                ,tab: function(pic, layero){
                    var str = "<div style='text-align: center'>"+pic.alt+"</div>";
                    layero.prepend(str);
                }
            });

            var k;
            var table_field;
            //var table_id = {$info['driver_id']};
            upload.render({
                elem: '.uploads'//这个就等同于点击
                ,url: '/admin/Upload/upload'
                ,before: function(obj){
                    var id_str='';
                    console.log(this.item.context.id)
                    id_str=this.item.context.id
                    var arr=id_str.split("-");
                    k = arr[1];
                    console.log(k);
                    table_field =  arr[2];
                    console.log(table_field)
                    //预读本地文件示例，不支持ie8
                }
                ,done:  function(res){ //上传后的回调
                    console.log(res)
                    console.log(k)
                    if(res.status == 1){
                        $("#image_"+k).css('display','');
                        $("#image_"+k).attr('src',res.data.file); //点击后的大图
                        $("#image_thumb_"+k+"0").attr('value',res.data.file_thumb); //小图
                        $("#img_"+k).attr('href',res.data.file);
                        $("#image_"+k+"0").attr('value',res.data.file); //点击后的大图
                    }else{
                        layer.msg(res.msg);
                    }
                }
                ,error: function(e){
                    console.log(e)
                    //layer.msg('上传失败');

                }
            });

        });

        function onclickSubmit(){

        }
    </script>
</block>